how does the payment gateway work